package com.yuch.utils;

import org.springframework.cache.annotation.Cacheable;

import java.util.Random;

public class CodeUtil {

    /**
     * ������֤��
     * @param n
     * @return
     */
    public static String createCode(int n) {
        StringBuffer buffer = new StringBuffer();
        Random random = new Random();
        int i = 0;
        while (i < n) {
            int r = random.nextInt(123);
            if ((r < 123 && r > 96) || (r < 91 && r > 40)) {
                buffer.append((char) r);
                i++;
            }
        }
        return buffer.toString();

    }


}
